<html>
<head><meta charset="utf-8"><title>Promotion regions · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Promotion.20regions.html">Promotion regions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242517581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Promotion%20regions/near/242517581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Promotion.20regions.html#242517581">(Jun 13 2021 at 15:54)</a>:</h4>
<p>During promotion, we create an <code>Rvalue::Ref</code> with <code>ReErased</code> in the promoted body: <a href="https://github.com/rust-lang/rust/blob/fb3ea63d9b4c3e9bb90d4250b870faaffb9c8fd2/compiler/rustc_mir/src/transform/promote_consts.rs#L917">https://github.com/rust-lang/rust/blob/fb3ea63d9b4c3e9bb90d4250b870faaffb9c8fd2/compiler/rustc_mir/src/transform/promote_consts.rs#L917</a></p>



<a name="242517588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Promotion%20regions/near/242517588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Promotion.20regions.html#242517588">(Jun 13 2021 at 15:54)</a>:</h4>
<p>where does that get converted into an <code>ReVar</code>?</p>



<a name="242517623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Promotion%20regions/near/242517623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Promotion.20regions.html#242517623">(Jun 13 2021 at 15:55)</a>:</h4>
<p>MIR borrowck I believe</p>



<a name="242517706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Promotion%20regions/near/242517706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Promotion.20regions.html#242517706">(Jun 13 2021 at 15:56)</a>:</h4>
<p>AFAIK it erases all lifetimes and then creates fresh <code>ReVar</code> for everything. MIR typeck is then used to collect all lifetime constraints after which MIR borrowck solves all constraints.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>